﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace OnlineGameLibrary.Contract
{
    [ServiceContract(Namespace="http://gameservice",CallbackContract=typeof(IGameRoomServiceCallBack))]
    public interface IGameRoomService
    {
        [OperationContract]
        void UserHeartBeat();

        [OperationContract]
        OperationResult UpdatePlayerState(PlayerState state);

        [OperationContract]
        List<GameInfo> GetGameList();

        [OperationContract]
        List<GameRoom> GetGameRooms();

        [OperationContract]
        GameRoom CreateGameRoom(GameConfig config);

        [OperationContract]
        OperationResult UpdateGameConfig(GameConfig config);

        [OperationContract]
        GameRoom AttendGameRoom(Guid gameid);

        [OperationContract]
        OperationResult LeaveGameRoom();

        [OperationContract]
        OperationResult GameStart();

        [OperationContract]
        GameConfig LoadGameConfig();

        [OperationContract]
        List<Player> LoadPlayer();

        [OperationContract]
        Player PlayerLogin(string name);

        [OperationContract(Action="http://gameaction",IsOneWay=true)]
        void SendMessageToGame(Message msg);

    }

    public interface IGameRoomServiceCallBack
    {
        [OperationContract(IsOneWay = true, Action = "http://gameaction")]
        void SendGameMessage(Message msg);
    }
}